Quarto for Reproduceable Reporting

Lisa Anders, Posit Solutions Engineer

2024-04-18

Let’s talk about Quarto


Lisa Anders - Posit Solutions Engineer and self-professed R nerd learning to love Python. Engineer turned data scientist turned Posit admin and excited to share lessons learned the hard way to make things easier for others. Also awkward at writing intros in the third person!

“Artwork from”Hello, Quarto” keynote by Julia Lowndes and Mine Çetinkaya-Rundel, presented at RStudio Conference 2022. Illustrated by Allison Horst

Logistics


Ask questions live, in the zoom chat, or raise your hand✋


Objectives:

  • Understand what quarto is all the amazing types of content it can be used to make
  • Learn how to create a new quarto project
  • Explore the bells and whistles to take your quarto projects to the next level
  • Plant the seeds for other best practices for reproduceable reporting

Acknowledgements


🫶

What is Quarto?

Quarto is an open source scientific and technical publishing framework. Use your favorite languages to create versatile, beautiful, and reproducible outputs.

  • Open source project sponsored by Posit, based on 10+ years of experience with RMarkdown
  • Re-imagining of rmarkdown to be completely language agnostic (with inspiration from jupyter notebooks)

“Artwork from”Hello, Quarto” keynote by Julia Lowndes and Mine Çetinkaya-Rundel, presented at RStudio Conference 2022. Illustrated by Allison Horst

How does Quarto work?

Quarto gives you options for the actual tool being used to render your project into a plethora of output types.

  • Bundled into RStudio starting with 2022.07.1
  • Rendering engines: Jupyter, knitr

“Artwork from”Hello, Quarto” keynote by Julia Lowndes and Mine Çetinkaya-Rundel, presented at RStudio Conference 2022. Illustrated by Allison Horst

There’s a lot to love with Quarto

  • Content types (dashboards, websites, documents, and more)
  • Code chunks
  • Custom formatting
  • Hybrid code projects
  • Extensions (lightbox)
  • Comments
  • Scheduling
  • Hosting on Connect

  • Environment management
  • Version control
  • Storing secrets in env variables
  • Parameterization
  • Conditionals
  • Including code / nested qmd’s

Image a meme of The Sound of Music

What makes this reproduceable?

Code first model where source code is included in all outputs:

  • version control
  • programmatic automation (testing)

Demystifying the different content types

  • Computational languages: Python, R, Julia, Observable JS
  • Outputs: Documents, presentations, websites, books, blogs

Report - HTML doc - PDF doc - Word doc Presentation Website Blog - The home page is a listing page for all of the documents in the posts directory Book

Getting started

Programmatically create a project:

quarto create project
quarto create project <type> <name>

Create a project using the RStudio editor

Anatomy of a Quarto project

Coming from R? RMarkdown Workflow

Rendering (execute and write to disk):

Programmatically

quarto render script.qmd

The RStudio editor comes with rendering built-in

Live preview:

quarto preview script.qmd

Coming from Python? Notebooks Workflow

Rendering (execute and write to disk):

# plain text qmd
quarto render python.qmd
quarto render python.qmd --to pdf

# ipynb notebook
quarto render python.ipynb
quarto render python.ipynb --execute

Live preview:

# plain text qmd
quarto preview python.qmd
quarto preview python.qmd --to pdf

# ipynb notebook
quarto preview python.ipynb
quarto preview python.ipynb --execute

On to the bells and whistles!

So you’ve got a finished product, now what? Publish to Connect

So you’ve got a finished product, now what? Job scheduling

Misc best practices

Version control your code

Reproduceable environments

Keep secrets secret

Imagine a world where code doesn’t disappear and is backed up in version control, environments are explicit and easily reproduced, and secrets are responsibly managed.


TLDR on Quarto

Interested in our Enterprise Products? Click here

TLDR on best practices

Version control:

Environment management:

Secrets:

Interested in our Enterprise Products? Click here

Thanks! Questions?

Backup

Default Slide

This text size is normal.

This text size is smaller.

Bullet points

  1. Point 1
  2. Point 2

Blocking comment

Column 1

Column 2

Figure 1: But what about an image?

Lisa Anders - Posit Solutions Engineer and self-professed R nerd learning to love Python. Engineer turned data scientist turned Posit admin and excited to share lessons learned the hard way to make things easier for others. Also awkward at writing intros in the third person!

“Illustration from Hadley Wickham’s talk”The Joy of Functional Programming (for Data Science).” by Allison Horst